package org.yq.timer;

import java.util.Date;

public class TimerBean {

	public static final long PERIOD_DAY = 1000 * 60 * 60 * 24;
	
	private String id ;
	/**
	 * TimerTask
	 */
	private String clsName;
	/**
	 *  
	 */
	private Long delay;
	
	private Long period;
	
	
	public TimerBean(String id, String clsName, Long delay, Long period) {
		super();
		this.id = id;
		this.clsName = clsName;
		this.delay = delay;
		this.period = period;
	}
	public TimerBean(String id, String clsName, long delay, long period) {
		super();
		this.id = id;
		this.clsName = clsName;
		this.delay = delay;
		this.period = period;
	}
	public TimerBean(String id, String clsName, Date delay, long period) {
		super();
		Date now = new Date();
		long _delay = delay.getTime() - now.getTime();
		this.id = id;
		this.clsName = clsName;
		this.delay = _delay < 0 ? 0 : _delay;
		this.period = period;
	}
	public TimerBean(String id, String clsName, long period) {
		super();
		this.id = id;
		this.clsName = clsName;
		this.delay = 0L;
		this.period = period;
	}
	public void setDelay(Date delay) {
		Date now = new Date();
		long _delay = delay.getTime() - now.getTime();
		this.delay = _delay < 0 ? 0 : _delay;
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getClsName() {
		return clsName;
	}
	public void setClsName(String clsName) {
		this.clsName = clsName;
	}
	public Long getDelay() {
		return delay;
	}
	public void setDelay(Long delay) {
		this.delay = delay;
	}
	public Long getPeriod() {
		return period;
	}
	public void setPeriod(Long period) {
		this.period = period;
	}
	
	
	
	
	
}
